from rest_framework import serializers

from apps.users.models import Student
from .models import *


class StudentSerializer(serializers.ModelSerializer):
    class Meta:
        model = Student
        fields = ('id', 'name', 'student_number', 'phone', 'sex')


class RoomSerializer(serializers.ModelSerializer):
    student_info = StudentSerializer(many=True)

    class Meta:
        model = Room
        fields = ('id', 'name', 'build_id', 'bed_type', 'number', 'actual_number', 'student_info')


class BuildManageSerializer(serializers.ModelSerializer):
    allRoom = RoomSerializer(many=True)

    class Meta:
        model = BuildManage
        fields = ('id', 'build_name', 'detail', 'allRoom')
